﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        private bool clicked;
        private Snake snake;
        private Food food;

        public Form1()
        {
            InitializeComponent();
            clicked = false;
            snake = new Snake();
            food = new Food(this);
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            snake.Move();
            snake.Draw(this);
            food.Draw(this);
            this.Refresh();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void toolStripStatusLabel1_Click(object sender, EventArgs e)
        {

        }

        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {

            if (e.KeyCode == Keys.Z)
            {
                snake.MoveUp();
            }
            if (e.KeyCode == Keys.S)
            {
                snake.MoveDown();
            }
            if (e.KeyCode == Keys.Q)
            {
                snake.MoveLeft();
            }
            if (e.KeyCode == Keys.D)
            {
                snake.MoveRight();
            }
        }
    }
}
